package com.example.lg.aliplaydemo470.view;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.widget.NestedScrollView;
import android.util.AttributeSet;
import android.util.Log;

/**
 * @Author: YuanPeikai
 * @CreateDate: 2019/8/20 11:51
 * @Description:
 */
public class CustomNestedScrollView extends NestedScrollView {
    private static final String TAG = "CustomNestedScrollView";

    public CustomNestedScrollView(@NonNull Context context) {
        super(context);
    }

    public CustomNestedScrollView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }


    @Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        super.onScrollChanged(l, t, oldl, oldt);

        if (mListener != null) {
            mListener.scrollChangedListener(t);
        }

    }

    public interface OnScrollChangedListener {
        void scrollChangedListener(int y);
    }

    public OnScrollChangedListener mListener;

    public void addOnScrollChangedListener(OnScrollChangedListener mListener) {
        this.mListener = mListener;

    }


}
